﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ApiBetaSeries.Factories;

namespace ApiBetaSeries.Services
{
    public class SeasonServices : ApiBetaSeries.Services.ISeasonServices
    {
         #region singleton
        private static SeasonServices m_seasonServices = null;
        private SeasonServices() { }
        public static SeasonServices GetInstance()
        {
            if (m_seasonServices == null)
            {
                m_seasonServices = new SeasonServices();
            }
            return m_seasonServices;
        }
        #endregion
        /// <summary>
        /// Get all the season of a show
        /// </summary>
        /// <param name="url">url of a show</param>
        /// <param name="token">Token of the user</param>
        /// <returns>List of seasons</returns>
        [ApiBetaSeries.Version.ApiMethod(false, "shows/episodes")]
        public List<ISeason> GetSeasons(string url, string token)
        {
            IShow show = ShowFactory.CreateShow();
            show.Url = url;
            return show.GetSeasons(token);
        }

        /// <summary>
        /// Get a specific season of a show
        /// </summary>
        /// <param name="url">url of the show</param>
        /// <param name="number">Season number</param>
        /// <param name="token">Token of the user</param>
        /// <returns>the season</returns>
        [ApiBetaSeries.Version.ApiMethod(false, "shows/episodes")]
        public ISeason GetSeason(string url, int number, string token)
        {
            IShow show = ShowFactory.CreateShow();
            show.Url = url;
            return show.GetSeason(number, token);
        }
    }
}
